package usb;

import java.util.Arrays;

public class Test04 {
    public static void main(String[] args) {
        int[] a = {5,3,2,4,1};
//        Arrays.sort(a);
//        System.out.println(Arrays.toString(a));

        for (int i=0;i<a.length-1;i++) {
            for(int j=0;j<a.length-1-i;j++){
                if(a[j]>a[j+1]){
                    //交换
                    int temp=a[j];
                    a[j]=a[j+1];
                    a[j+1]=temp;
                }
            }
        }
        System.out.println(Arrays.toString(a));
    }
}
